package org.magento.pages;


import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;

//page located /customer/account/ - customer account page (customer cabinet) 
public class MyDashboard  extends Page {
	
	//Locators:
	@FindBy(linkText = "Log Out")
	public WebElement logOut;
	
	
	//Actions: 
	public LogoutConfirmPage logOut() {
		logOut.click();
		return PageFactory.initElements(driver, LogoutConfirmPage.class);
	}
	
	//Assertions: 
	public boolean isMyDashboardDisplayed(){
		return driver.findElement(By.cssSelector("BODY")).getText().contains("My Dashboard");
	}
	
	public boolean isUserLoggedIn() {
		return driver.findElement(By.cssSelector("BODY")).getText().contains("denis.ulyanov@iceshop.nl");
	}
		
	public boolean isNewCustomerCreated() {
		return driver.findElement(By.cssSelector("BODY")).getText().contains("Thank you for registering with Main Website Store.");
	}
	
	//Auto - generated 
	public MyDashboard(WebDriver driver) {
		super(driver);
	}

	@Override
	public void open() {
	}

}
